package com.acane.instagram.feature.profile

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.compose.composable
import kotlin.reflect.KFunction0

const val PROFILE_ROUTE = "profile"
const val PROFILE_ROUTE_WITH_USER_ID = "user_id"

fun NavGraphBuilder.profileScreen(
    navController: NavHostController,
    toProfile: (String) -> Unit,
    toChat: (String) -> Unit,
    toPost: (String, Int) -> Unit,
    toFollow: (String, String) -> Unit,
    toEditMe: KFunction0<Unit>,
) {
    composable("${PROFILE_ROUTE}/{${PROFILE_ROUTE_WITH_USER_ID}}") {
        ProfileRoute(
            navController = navController,
            toProfile = toProfile,
            toChat = toChat,
            toPost = toPost,
            toFollow = toFollow,
        )
    }
}

fun NavController.navigateToProfile(userId: String): Unit {
    navigate("${PROFILE_ROUTE}/$userId")
}